<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="SprintTasksReport.aspx.cs" Inherits="SprintTasksReport" Title="Tackle - Sprint Task and Resources Report" %>

<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
    Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentHolder" Runat="Server">
    <strong>Sprint Task &amp; Resources Report<br />
        <br />
    </strong><span style="font-size: 8pt">Filter the data as required. Use the report
        selector to switch between products, owners and remaining work.<br />
    </span>
    <br />
    <table style="width: 98%" cellpadding="4" cellspacing="0">
        <tr>
            <td style="border-top: silver 1px ridge; border-left: silver 1px ridge; border-bottom: silver 1px ridge" bgcolor="#e3eaeb" valign="top">
                <span style="font-size: x-small">Sprint: </span>
                <asp:DropDownList ID="ddSprintSelection" runat="server" AutoPostBack="True" DataSourceID="dsGetSprintNames"
                    DataTextField="SprintName" DataValueField="SprintID" Font-Size="X-Small" OnDataBound="ddSprintSelection_DataBound" OnSelectedIndexChanged="ddSprintSelection_SelectedIndexChanged" >
                </asp:DropDownList></td>
            <td style="border-top: silver 1px ridge; border-bottom: silver 1px ridge" bgcolor="#e3eaeb" valign="top">
                <span style="font-size: x-small">
                Product:
                    <asp:DropDownList ID="ddProduct" runat="server" Font-Names="Verdana" Font-Size="X-Small" AutoPostBack="True" DataSourceID="dsProductList" DataTextField="ProductName" DataValueField="ProductID" OnSelectedIndexChanged="ddProduct_SelectedIndexChanged" OnDataBound="ddProduct_DataBound">
                        <asp:ListItem Value="-1">All</asp:ListItem>
                    </asp:DropDownList></span></td>
            <td style="border-top: silver 1px ridge; border-bottom: silver 1px ridge" bgcolor="#e3eaeb" valign="top">
                <span style="font-size: x-small">
                Feature:
                    <asp:DropDownList ID="ddFeature" runat="server" Font-Names="Verdana" Font-Size="X-Small" AutoPostBack="True" DataSourceID="dsFeatureList" DataTextField="ProdFeature" DataValueField="FeatureID" OnSelectedIndexChanged="ddFeature_SelectedIndexChanged" OnDataBound="ddFeature_DataBound">
                        <asp:ListItem Value="-1">All</asp:ListItem>
                    </asp:DropDownList></span></td>
            <td colspan="2" style="border-top: silver 1px ridge; border-bottom: silver 1px ridge" bgcolor="#e3eaeb" valign="top">
                <span style="font-size: x-small">
                Owner:
                    <asp:DropDownList ID="ddOwner" runat="server" Font-Names="Verdana" Font-Size="X-Small" AutoPostBack="True" DataSourceID="dsTaskOwners" DataTextField="Owner" DataValueField="SprintResourcesID" OnSelectedIndexChanged="ddOwner_SelectedIndexChanged" OnDataBound="ddOwner_DataBound">
                        <asp:ListItem Value="-1">All</asp:ListItem>
                    </asp:DropDownList></span></td>
            <td colspan="1" style="border-right: silver 1px ridge; border-top: silver 1px ridge; border-bottom: silver 1px ridge;" bgcolor="#e3eaeb" valign="top">
                <span style="font-size: x-small; border-right: silver 1px ridge;"> </span><span style="font-size: x-small">
                    Report: </span>
                <asp:DropDownList ID="ddWhichReportList" runat="server" Font-Names="Verdana" Font-Size="X-Small"
                    OnSelectedIndexChanged="ddWhichReportList_SelectedIndexChanged" AutoPostBack="True" OnPreRender="ddWhichReportList_PreRender">
                    <asp:ListItem Value="SprintTasksReport.rdlc">Per Product</asp:ListItem>
                    <asp:ListItem Value="SprintTasksReportUser.rdlc">Per Owner</asp:ListItem>
                    <asp:ListItem Value="SprintTasksReportRemaining.rdlc">Remaining Work</asp:ListItem>
                    <asp:ListItem Value="SprintTasksReportBalancing.rdlc">Per Product (Balancing)</asp:ListItem>
                    <asp:ListItem Value="SprintTasksReportUserBalancing.rdlc">Per Owner (Balancing)</asp:ListItem>
                </asp:DropDownList></td>
        </tr>
        <tr>
            <td colspan="6">
                <rsweb:ReportViewer ID="repViewTasksResources" runat="server" Font-Names="Verdana" Font-Size="8pt"
                    Height="400px" Width="100%">
                    <LocalReport ReportPath="SprintTasksReport.rdlc">
                        <DataSources>
                            <rsweb:ReportDataSource DataSourceId="odsTaskResources" Name="DataSet1_TasksResources" />
                            <rsweb:ReportDataSource DataSourceId="odsProductBreakdownPerSprint" Name="DataSet1_ProductBreakdownPerSprint" />
                            <rsweb:ReportDataSource DataSourceId="odsScrumTeamPrefs" Name="DataSet1_ScrumTeamPrefs" />
                        </DataSources>
                    </LocalReport>
                </rsweb:ReportViewer>
                <asp:ObjectDataSource ID="odsTaskResources" runat="server" OldValuesParameterFormatString="original_{0}"
                    SelectMethod="GetData" TypeName="DataSet1TableAdapters.TasksResourcesTableAdapter">
                    <SelectParameters>
                        <asp:ControlParameter ControlID="ddSprintSelection" Name="SprintID" PropertyName="SelectedValue"
                            Type="Int32" />
                        <asp:SessionParameter DefaultValue="" Name="ProductName" SessionField="STRProdName"
                            Type="String" />
                        <asp:SessionParameter DefaultValue="" Name="Feature" SessionField="STRFeature" Type="String" />
                        <asp:SessionParameter DefaultValue="" Name="Owner" SessionField="STROwner" Type="String" />
                        <asp:SessionParameter Name="TimeMult" SessionField="SBTimeMult" Type="Single" />
                    </SelectParameters>
                </asp:ObjectDataSource>
                <asp:ObjectDataSource ID="odsProductBreakdownPerSprint" runat="server" OldValuesParameterFormatString="original_{0}"
                    SelectMethod="GetData" TypeName="DataSet1TableAdapters.ProductBreakdownPerSprintTableAdapter">
                    <SelectParameters>
                        <asp:ControlParameter ControlID="ddSprintSelection" Name="SprintID" PropertyName="SelectedValue"
                            Type="Int32" />
                    </SelectParameters>
                </asp:ObjectDataSource>
                <asp:ObjectDataSource ID="odsScrumTeamPrefs" runat="server" OldValuesParameterFormatString="original_{0}"
                    SelectMethod="GetData" TypeName="DataSet1TableAdapters.ScrumTeamPrefsTableAdapter">
                    <SelectParameters>
                        <asp:SessionParameter Name="ScrumTeamID" SessionField="ScrumTeamID" Type="Int32" />
                    </SelectParameters>
                </asp:ObjectDataSource>
                &nbsp;
                &nbsp;&nbsp;
            </td>
        </tr>
    </table>
    <asp:SqlDataSource ID="dsGetSprintNames" runat="server" ConnectionString="<%$ ConnectionStrings:TackleConnectionStringMain %>"
        SelectCommand="SELECT DISTINCT tblMasterBacklogSchedule.SprintName, tblMasterBacklogSchedule.EndDate, tblSprint.SprintID FROM tblSprint LEFT OUTER JOIN tblSprintBacklog ON tblSprint.SprintID = tblSprintBacklog.fSprintID RIGHT OUTER JOIN tblMasterBacklogSchedule ON tblSprint.fMasterBacklogScheduleID = tblMasterBacklogSchedule.MasterBacklogScheduleID WHERE (tblMasterBacklogSchedule.fScrumTeamID = @ScrumTeamID) AND (tblSprintBacklog.fSprintID IS NOT NULL) ORDER BY tblMasterBacklogSchedule.EndDate DESC">
        <SelectParameters>
            <asp:SessionParameter Name="ScrumTeamID" SessionField="ScrumTeamID" />
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="dsProductList" runat="server" ConnectionString="<%$ ConnectionStrings:TackleConnectionStringMain %>"
        SelectCommand="SELECT DISTINCT tblProducts.ProductName, tblProducts.ProductID FROM tblSprintBacklog INNER JOIN tblMasterBacklog ON tblSprintBacklog.fMasterBacklogID = tblMasterBacklog.MasterBacklogID INNER JOIN tblProducts ON tblMasterBacklog.fProductID = tblProducts.ProductID WHERE (tblSprintBacklog.fSprintID = @SprintID) UNION SELECT ' All' as ProductName, -1 as ProductID&#13;&#10;ORDER BY tblProducts.ProductName ">
        <SelectParameters>
            <asp:ControlParameter ControlID="ddSprintSelection" Name="SprintID" PropertyName="SelectedValue" />
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="dsFeatureList" runat="server" ConnectionString="<%$ ConnectionStrings:TackleConnectionStringMain %>"
        ProviderName="<%$ ConnectionStrings:TackleConnectionStringMain.ProviderName %>"
        SelectCommand="SELECT DISTINCT tblMasterBacklog.Feature AS ProdFeature, tblMasterBacklog.MasterBacklogID AS FeatureID, tblMasterBacklog.MasterRank FROM tblSprintBacklog INNER JOIN tblMasterBacklog ON tblSprintBacklog.fMasterBacklogID = tblMasterBacklog.MasterBacklogID INNER JOIN tblProducts ON tblMasterBacklog.fProductID = tblProducts.ProductID WHERE (tblMasterBacklog.fProductID = @ProductID) UNION SELECT ' All' as ProdFeature, -1 as FeatureID, -1 as MasterRank ORDER BY tblMasterBacklog.MasterRank, FeatureID">
        <SelectParameters>
            <asp:ControlParameter ControlID="ddProduct" Name="ProductID" PropertyName="SelectedValue" />
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="dsTaskOwners" runat="server" ConnectionString="<%$ ConnectionStrings:TackleConnectionStringMain %>"
        ProviderName="<%$ ConnectionStrings:TackleConnectionStringMain.ProviderName %>"
        SelectCommand="SELECT DISTINCT tblSprintResources.Person AS Owner, tblSprintResources.SprintResourcesID FROM tblSprintBacklog INNER JOIN tblSprintResources ON tblSprintBacklog.TaskOwnerID = tblSprintResources.SprintResourcesID WHERE (tblSprintBacklog.fSprintID = @SprintID) UNION SELECT ' All' as Owner, -1 as SprintResourcesID ORDER BY Owner">
        <SelectParameters>
            <asp:ControlParameter ControlID="ddSprintSelection" Name="SprintID" PropertyName="SelectedValue" />
        </SelectParameters>
    </asp:SqlDataSource>
</asp:Content>

